package com.runjian.demo.controller;


import cn.hutool.json.JSONObject;
import com.runjian.demo.base.Result;
import com.runjian.demo.config.BaseConfig;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Tag(name = "首页-接口")
@RestController
@RequestMapping("/api/index")
public class IndexController {
    @Operation(summary = "getList")
    @GetMapping("/getList")
    public Result<List<JSONObject>> getList() {
        return Result.success(BaseConfig.getList());
    }

    @Operation(summary = "Get")
    @GetMapping("/record")
    public String record1() {
        return "Hello World!";
    }

    @Operation(summary = "Post")
    @PostMapping("record/{userId}")
    public String record2(@PathVariable("userId") Integer userid) {
        return "Hello World!";
    }

    @Operation(summary = "Put")
    @PutMapping("record")
    public String record3() {
        return "Hello World!";
    }

    @Operation(summary = "Delete")
    @DeleteMapping("record")
    public String record4() {
        return "Hello World!";
    }
}
